package com.heima.kafka.listener;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Component;

/**
 * @BelongsProject: heima-leadnews
 * @BelongsPackage: com.heima.kafka.listener
 * @Author: wangjian
 * @CreateTime: 2022-07-03  23:50
 * @Description: TODO
 * @Version: 1.0
 */
@Component
public class MyKafkaListener {
    @KafkaListener(topics = "spring_test")
    public void handleMessage(ConsumerRecord<String, String> record) {
        System.out.println("接收到消息,偏移量为: " + record.offset() + " 消息为: " + record.value());
    }
}
